---
title: "Is a Picture Worth 280 Characters?"
subtitle: "Experiments 1 and 2 (Appendix B)" 
author: "Benjamin Norwood Harris"
output: pdf_document
---

```{r}

library(stargazer)
library(lmtest)
library(ggplot2)
library(TOSTER)

#set WD and read in data.  

setwd("/Users/harri/Dropbox (MIT)/Is a Picture Worth 280 Characters (Updated)/JEPS, Submission Folder, July 2023/JEPS 2nd R+R/Replication Materials/")
DF3 <-read.csv("Data, Experiments 1 and 2, June 2023.csv", fileEncoding = "UTF-8-BOM")
```


#Demographic Table Stats 


```{r}
#gender balance 

table(DF3$Q.Female)

length(na.omit(DF3$Q.Female[DF3$Q.Female==0]))/length(DF3$Q.Female)
sum(na.omit(DF3$Q.Female))/length(DF3$Q.Female)

sum(is.na(DF3$Q.Female))/length(DF3$Q.Female)

```


```{r}

# race 
sum(na.omit(DF3$Q.White))/length((DF3$Q.White))
sum(na.omit(DF3$Q.Black))/length((DF3$Q.Black))

sum(na.omit(DF3$Q.AIorAN))/length((DF3$Q.AIorAN))
sum(na.omit(DF3$Q.Asian))/length((DF3$Q.Asian))

sum(na.omit(DF3$Q.NHorPI))/length((DF3$Q.NHorPI))
sum(na.omit(DF3$Q.Hispanic))/length((DF3$Q.Hispanic))

sum(na.omit(DF3$Q.Mixed))/length((DF3$Q.Mixed))
sum(na.omit(DF3$Q.Other))/length((DF3$Q.Other))

sum(na.omit(DF3$Q.Other_Mixed))/length((DF3$Q.Other_Mixed))
sum(is.na(DF3$Q.Race))/length(DF3$Q.Race)



```


```{r}
# age 

summary(DF3$Q.Age)
```


```{r}
#education 

table(DF3$Q.Education)

sum((na.omit(DF3$Q.HighSchool)))/length((DF3$Q.HighSchool))
sum((na.omit(DF3$Q.Bach)))/length((DF3$Q.Bach))

sum(is.na(DF3$Q.Education))/length(DF3$Q.Education)

```


```{r}

#income 

table(DF3$Q.Income)


length(na.omit(DF3$Q.Income[DF3$Q.Income==1]))/length(DF3$Q.Income)
length(na.omit(DF3$Q.Income[DF3$Q.Income==2]))/length(DF3$Q.Income)

length(na.omit(DF3$Q.Income[DF3$Q.Income==3]))/length(DF3$Q.Income)
length(na.omit(DF3$Q.Income[DF3$Q.Income==4]))/length(DF3$Q.Income)

length(na.omit(DF3$Q.Income[DF3$Q.Income==5]))/length(DF3$Q.Income)
length(na.omit(DF3$Q.Income[DF3$Q.Income==6]))/length(DF3$Q.Income)

length(na.omit(DF3$Q.Income[DF3$Q.Income==7]))/length(DF3$Q.Income)
length(na.omit(DF3$Q.Income[DF3$Q.Income==8]))/length(DF3$Q.Income)



sum(is.na(DF3$Q.Income))/length(DF3$Q.Income)

```


```{r}

#political ID

table(DF3$Q.Political_ID)

sum(na.omit(DF3$Q.Liberal))/length((DF3$Q.Liberal))
sum(na.omit(DF3$Q.Moderate))/length((DF3$Q.Moderate))
sum(na.omit(DF3$Q.Conservative))/length((DF3$Q.Conservative))


sum(is.na(DF3$Q.Political_ID))/length(DF3$Q.Political_ID)

```


```{r}

#veteran status 

table(DF3$Q.Veteran)
length(na.omit(DF3$Q.Veteran[DF3$Q.Veteran==0]))/length(DF3$Q.Veteran)
length(na.omit(DF3$Q.Veteran[DF3$Q.Veteran==1]))/length(DF3$Q.Veteran)

sum(is.na(DF3$Q.Veteran))/length(DF3$Q.Veteran)


```



```{r}

#Twitter_Use 

table(DF3$Q.Twitter_Use)



length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==1]))/length(DF3$Q.Twitter_Use)
length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==2]))/length(DF3$Q.Twitter_Use)
length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==3]))/length(DF3$Q.Twitter_Use)
length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==4]))/length(DF3$Q.Twitter_Use)
length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==5]))/length(DF3$Q.Twitter_Use)
sum(is.na(DF3$Q.Twitter_Use))/length(DF3$Q.Twitter_Use)

```



# Tweet Analysis 

## Substantive Questions

```{r}
#time for some regressions 

#let's do a couple different models 

##DV: credibility, IV: Tweet binary  

## Model 1: No Demographics 

T.Cred_Form_1 <- Credibility_Tweet ~ Tweet   

## Model 5: Factor Demographics 

T.Cred_Form_5 <- 
  Credibility_Tweet ~ Tweet + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

T.Cred_Form_7 <- Credibility_Tweet ~ Tweet + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

T.Cred_1 <- lm(T.Cred_Form_1, 
             data = DF3, 
             na.action=na.omit)

T.Cred_5 <- lm(T.Cred_Form_5, 
             data = DF3, 
             na.action=na.omit)

T.Cred_7 <- lm(T.Cred_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(T.Cred_1, T.Cred_5, T.Cred_7, title = "Twitter Experiment, Perceived Credibility", no.space = TRUE)

```

```{r}

##DV: POTUS_Support, IV: Tweet binary  

## Model 1: No Demographics 

T.Potus_Form_1 <- POTUS_Support ~ Tweet   

## Model 5: Factor Demographics 

T.Potus_Form_5 <- 
  POTUS_Support ~ Tweet + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

T.Potus_Form_7 <- POTUS_Support ~ Tweet + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

T.Potus_1 <- lm(T.Potus_Form_1, 
             data = DF3, 
             na.action=na.omit)

T.Potus_5 <- lm(T.Potus_Form_5, 
             data = DF3, 
             na.action=na.omit)

T.Potus_7 <- lm(T.Potus_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(T.Potus_1, T.Potus_5, T.Potus_7, title = "Twitter, Support for President", no.space = TRUE)

```

```{r}

##DV: Iran_Perception, IV: Tweet binary  

## Model 1: No Demographics 

T.Iran_Form_1 <- Iran_Perception ~ Tweet   

## Model 5: Factor Demographics 

T.Iran_Form_5 <- 
  Iran_Perception ~ Tweet + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

T.Iran_Form_7 <- Iran_Perception ~ Tweet + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

T.Iran_1 <- lm(T.Iran_Form_1, 
             data = DF3, 
             na.action=na.omit)

T.Iran_5 <- lm(T.Iran_Form_5, 
             data = DF3, 
             na.action=na.omit)

T.Iran_7 <- lm(T.Iran_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(T.Iran_1, T.Iran_5, T.Iran_7, title = "Twitter, Perception of Iran", no.space = TRUE)

```



```{r}

##DV: Crisis_Realism_Tweet, IV: Tweet binary  

## Model 1: No Demographics 

T.Realism_Form_1 <- Crisis_Realism_Tweet ~ Tweet   

## Model 5: Factor Demographics 

T.Realism_Form_5 <- 
  Crisis_Realism_Tweet ~ Tweet + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

T.Realism_Form_7 <- Crisis_Realism_Tweet ~ Tweet + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

T.Realism_1 <- lm(T.Realism_Form_1, 
             data = DF3, 
             na.action=na.omit)

T.Realism_5 <- lm(T.Realism_Form_5, 
             data = DF3, 
             na.action=na.omit)

T.Realism_7 <- lm(T.Realism_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(T.Realism_1, T.Realism_5, T.Realism_7, title = "Twitter, Perception of Crisis Realism", no.space = TRUE)

```












## Timing and AC Questions 

```{r}

##DV: Twitter_Timer, IV: Tweet binary  

## Model 1: No Demographics 

T.Timer_Form_1 <- Twitter_Timer ~ Tweet   

## Model 5: Factor Demographics 

T.Timer_Form_5 <- 
  Twitter_Timer ~ Tweet + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

T.Timer_Form_7 <- Twitter_Timer ~ Tweet + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

T.Timer_1 <- lm(T.Timer_Form_1, 
             data = DF3, 
             na.action=na.omit)

T.Timer_5 <- lm(T.Timer_Form_5, 
             data = DF3, 
             na.action=na.omit)

T.Timer_7 <- lm(T.Timer_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(T.Timer_1, T.Timer_5, T.Timer_7, title = "Twitter, Time Spent on Treatment", no.space = TRUE)

```


```{r}

##DV: Target_Check_Binary, IV: Tweet binary  

## Model 1: No Demographics 

T.Target_Form_1 <- Target_Check_Binary ~ Tweet   

## Model 5: Factor Demographics 

T.Target_Form_5 <- 
  Target_Check_Binary ~ Tweet + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

T.Target_Form_7 <- Target_Check_Binary ~ Tweet + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

T.Target_1 <- lm(T.Target_Form_1, 
             data = DF3, 
             na.action=na.omit)

T.Target_5 <- lm(T.Target_Form_5, 
             data = DF3, 
             na.action=na.omit)

T.Target_7 <- lm(T.Target_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(T.Target_1, T.Target_5, T.Target_7, title = "Twitter, Target Check", no.space = TRUE)

```




```{r}

##DV: Support_Check_Binary, IV: Tweet binary  

## Model 1: No Demographics 

T.Support_Form_1 <- Support_Check_Binary ~ Tweet   

## Model 5: Factor Demographics 

T.Support_Form_5 <- 
  Support_Check_Binary ~ Tweet + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

T.Support_Form_7 <- Support_Check_Binary ~ Tweet + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

T.Support_1 <- lm(T.Support_Form_1, 
             data = DF3, 
             na.action=na.omit)

T.Support_5 <- lm(T.Support_Form_5, 
             data = DF3, 
             na.action=na.omit)

T.Support_7 <- lm(T.Support_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(T.Support_1, T.Support_5, T.Support_7, title = "Twitter, Support Check", no.space = TRUE)

```




```{r}

##DV: Sea_Check_Binary, IV: Tweet binary  

## Model 1: No Demographics 

T.Sea_Form_1 <- Sea_Check_Binary ~ Tweet   

## Model 5: Factor Demographics 

T.Sea_Form_5 <- 
  Sea_Check_Binary ~ Tweet + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

T.Sea_Form_7 <- Sea_Check_Binary ~ Tweet + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

T.Sea_1 <- lm(T.Sea_Form_1, 
             data = DF3, 
             na.action=na.omit)

T.Sea_5 <- lm(T.Sea_Form_5, 
             data = DF3, 
             na.action=na.omit)

T.Sea_7 <- lm(T.Sea_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(T.Sea_1, T.Sea_5, T.Sea_7, title = "Twitter, Sea Check", no.space = TRUE)

```

## P-Values


```{r}

summary(T.Cred_7)$coefficients[2,]
summary(T.Potus_7)$coefficients[2,]
summary(T.Iran_7)$coefficients[2,]
summary(T.Realism_7)$coefficients[2,]

summary(T.Timer_7)$coefficients[2,]
summary(T.Target_7)$coefficients[2,]
summary(T.Support_7)$coefficients[2,]
summary(T.Sea_7)$coefficients[2,]


```



# ICA Analysis 

## Substantive Questions

```{r}

##DV: credibility, IV: ICA binary  

## Model 1: No Demographics 

I.Cred_Form_1 <- Credibility_Leaked ~ ICA   

## Model 5: Factor Demographics 

I.Cred_Form_5 <- 
  Credibility_Leaked ~ ICA + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

I.Cred_Form_7 <- Credibility_Leaked ~ ICA + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

I.Cred_1 <- lm(I.Cred_Form_1, 
             data = DF3, 
             na.action=na.omit)

I.Cred_5 <- lm(I.Cred_Form_5, 
             data = DF3, 
             na.action=na.omit)

I.Cred_7 <- lm(I.Cred_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(I.Cred_1, I.Cred_5, I.Cred_7, title = "Leaked ICA, Perceived Credibility", no.space = TRUE)

```

```{r}

##DV: Intl_Perception, IV: ICA binary  

## Model 1: No Demographics 

I.Intl_Form_1 <- Intl_Perception ~ ICA   

## Model 5: Factor Demographics 

I.Intl_Form_5 <- 
  Intl_Perception ~ ICA + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

I.Intl_Form_7 <- Intl_Perception ~ ICA + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

I.Intl_1 <- lm(I.Intl_Form_1, 
             data = DF3, 
             na.action=na.omit)

I.Intl_5 <- lm(I.Intl_Form_5, 
             data = DF3, 
             na.action=na.omit)

I.Intl_7 <- lm(I.Intl_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(I.Intl_1, I.Intl_5, I.Intl_7, title = "Leaked ICA, International Perception", no.space = TRUE)

```


```{r}

##DV: Authenticity, IV: ICA binary  

## Model 1: No Demographics 

I.Auth_Form_1 <- Authenticity ~ ICA   

## Model 5: Factor Demographics 

I.Auth_Form_5 <- 
  Authenticity ~ ICA + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

I.Auth_Form_7 <- Authenticity ~ ICA + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

I.Auth_1 <- lm(I.Auth_Form_1, 
             data = DF3, 
             na.action=na.omit)

I.Auth_5 <- lm(I.Auth_Form_5, 
             data = DF3, 
             na.action=na.omit)

I.Auth_7 <- lm(I.Auth_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(I.Auth_1, I.Auth_5, I.Auth_7, title = "Leaked ICA, Perceived Authenticity", no.space = TRUE)

```



```{r}

##DV: Crisis_Realism_Leak, IV: ICA binary  

## Model 1: No Demographics 

I.Realism_Form_1 <- Crisis_Realism_Leak ~ ICA   

## Model 5: Factor Demographics 

I.Realism_Form_5 <- 
  Crisis_Realism_Leak ~ ICA + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

I.Realism_Form_7 <- Crisis_Realism_Leak ~ ICA + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

I.Realism_1 <- lm(I.Realism_Form_1, 
             data = DF3, 
             na.action=na.omit)

I.Realism_5 <- lm(I.Realism_Form_5, 
             data = DF3, 
             na.action=na.omit)

I.Realism_7 <- lm(I.Realism_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(I.Realism_1, I.Realism_5, I.Realism_7, title = "Leaked ICA, Perception of Crisis Realism", no.space = TRUE)

```

## Timing and AC Questions 

```{r}

##DV: ICA_Timer, IV: ICA binary  

## Model 1: No Demographics 

I.Timer_Form_1 <- ICA_Timer ~ ICA   

## Model 5: Factor Demographics 

I.Timer_Form_5 <- 
  ICA_Timer ~ ICA + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

I.Timer_Form_7 <- ICA_Timer ~ ICA + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

I.Timer_1 <- lm(I.Timer_Form_1, 
             data = DF3, 
             na.action=na.omit)

I.Timer_5 <- lm(I.Timer_Form_5, 
             data = DF3, 
             na.action=na.omit)

I.Timer_7 <- lm(I.Timer_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(I.Timer_1, I.Timer_5, I.Timer_7, title = "Leaked ICA, Time Spent on Treatment", no.space = TRUE)

```


```{r}

##DV: Used_Check_Binary, IV: ICA binary  

## Model 1: No Demographics 

I.Used_Form_1 <- Used_Check_Binary ~ ICA   

## Model 5: Factor Demographics 

I.Used_Form_5 <- 
  Used_Check_Binary ~ ICA + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

I.Used_Form_7 <- Used_Check_Binary ~ ICA + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

I.Used_1 <- lm(I.Used_Form_1, 
             data = DF3, 
             na.action=na.omit)

I.Used_5 <- lm(I.Used_Form_5, 
             data = DF3, 
             na.action=na.omit)

I.Used_7 <- lm(I.Used_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(I.Used_1, I.Used_5, I.Used_7, title = "Leaked ICA, Used Check", no.space = TRUE)

```

```{r}

##DV: Supplied_Check_Binary, IV: ICA binary  

## Model 1: No Demographics 

I.Supplied_Form_1 <- Supplied_Check_Binary ~ ICA   

## Model 5: Factor Demographics 

I.Supplied_Form_5 <- 
  Supplied_Check_Binary ~ ICA + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

I.Supplied_Form_7 <- Supplied_Check_Binary ~ ICA + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

I.Supplied_1 <- lm(I.Supplied_Form_1, 
             data = DF3, 
             na.action=na.omit)

I.Supplied_5 <- lm(I.Supplied_Form_5, 
             data = DF3, 
             na.action=na.omit)

I.Supplied_7 <- lm(I.Supplied_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(I.Supplied_1, I.Supplied_5, I.Supplied_7, title = "Leaked ICA, Supplied Check", no.space = TRUE)

```


```{r}

##DV: Intel_Check_Binary, IV: ICA binary  

## Model 1: No Demographics 

I.Intel_Form_1 <- Intel_Check_Binary ~ ICA   

## Model 5: Factor Demographics 

I.Intel_Form_5 <- 
  Intel_Check_Binary ~ ICA + Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

I.Intel_Form_7 <- Intel_Check_Binary ~ ICA + Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

I.Intel_1 <- lm(I.Intel_Form_1, 
             data = DF3, 
             na.action=na.omit)

I.Intel_5 <- lm(I.Intel_Form_5, 
             data = DF3, 
             na.action=na.omit)

I.Intel_7 <- lm(I.Intel_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(I.Intel_1, I.Intel_5, I.Intel_7, title = "Leaked ICA, Intel Check", no.space = TRUE)

```


## P-Values


```{r}

summary(I.Realism_7)$coefficients[2,]
summary(I.Auth_7)$coefficients[2,]
summary(I.Intl_7)$coefficients[2,]
summary(I.Cred_7)$coefficients[2,]

summary(I.Timer_7)$coefficients[2,]
summary(I.Used_7)$coefficients[2,]
summary(I.Supplied_7)$coefficients[2,]
summary(I.Intel_7)$coefficients[2,]


```


# Means and SE Estimates 

## Twitter 

### Substantive Questions 


```{r}
##### Credibility_Tweet

T.Cred_Full_1 <- Credibility_Tweet ~ 0 + as.factor(Tweet) 


lm_T.Cred_Full_1 <- lm(T.Cred_Full_1, 
                     data = DF3)

summary(lm_T.Cred_Full_1)
length(na.omit(DF3$Credibility_Tweet[DF3$Tweet==1]))
length(na.omit(DF3$Credibility_Tweet[DF3$Tweet==0]))
```


```{r}
##### POTUS_Support

T.Potus_Full_1 <- POTUS_Support ~ 0 + as.factor(Tweet) 


lm_T.Potus_Full_1 <- lm(T.Potus_Full_1, 
                     data = DF3)

summary(lm_T.Potus_Full_1)
length(na.omit(DF3$POTUS_Support[DF3$Tweet==1]))
length(na.omit(DF3$POTUS_Support[DF3$Tweet==0]))
```

```{r}
##### Iran_Perception

T.Iran_Full_1 <- Iran_Perception ~ 0 + as.factor(Tweet) 


lm_T.Iran_Full_1 <- lm(T.Iran_Full_1, 
                     data = DF3)

summary(lm_T.Iran_Full_1)
length(na.omit(DF3$Iran_Perception[DF3$Tweet==1]))
length(na.omit(DF3$Iran_Perception[DF3$Tweet==0]))
```


```{r}
##### Crisis_Realism_Tweet

T.Realism_Full_1 <- Crisis_Realism_Tweet ~ 0 + as.factor(Tweet) 


lm_T.Realism_Full_1 <- lm(T.Realism_Full_1, 
                     data = DF3)

summary(lm_T.Realism_Full_1)
length(na.omit(DF3$Crisis_Realism_Tweet[DF3$Tweet==1]))
length(na.omit(DF3$Crisis_Realism_Tweet[DF3$Tweet==0]))
```


### Timing and AC 


```{r}
##### Twitter_Timer

T.Timer__Full_1 <- Twitter_Timer ~ 0 + as.factor(Tweet) 


lm_T.Timer__Full_1 <- lm(T.Timer__Full_1, 
                     data = DF3)

summary(lm_T.Timer__Full_1)
length(na.omit(DF3$Twitter_Timer[DF3$Tweet==1]))
length(na.omit(DF3$Twitter_Timer[DF3$Tweet==0]))
```

```{r}
##### Target Check 
T.Target_Full_1 <- Target_Check_Binary ~ 0 + as.factor(Tweet) 

lm_T.Target_Full_1 <- lm(T.Target_Full_1, 
                     data = DF3)

summary(lm_T.Target_Full_1)
length(na.omit(DF3$Target_Check_Binary[DF3$Tweet==1]))
length(na.omit(DF3$Target_Check_Binary[DF3$Tweet==0]))
```


```{r}
##### Support Check 
T.Support_Full_1 <- Support_Check_Binary ~ 0 + as.factor(Tweet) 

lm_T.Support_Full_1 <- lm(T.Support_Full_1, 
                     data = DF3)

summary(lm_T.Support_Full_1)
length(na.omit(DF3$Support_Check_Binary[DF3$Tweet==1]))
length(na.omit(DF3$Support_Check_Binary[DF3$Tweet==0]))
```


```{r}
##### Sea Check 
T.Sea_Full_1 <- Sea_Check_Binary ~ 0 + as.factor(Tweet) 

lm_T.Sea_Full_1 <- lm(T.Sea_Full_1, 
                     data = DF3)

summary(lm_T.Sea_Full_1)
length(na.omit(DF3$Sea_Check_Binary[DF3$Tweet==1]))
length(na.omit(DF3$Sea_Check_Binary[DF3$Tweet==0]))

```

## Leaked ICA 

### Substantive Questions 

```{r}
##### Credibility_Leaked

I.Cred_Full_1 <- Credibility_Leaked ~ 0 + as.factor(ICA) 


lm_I.Cred_Full_1 <- lm(I.Cred_Full_1, 
                     data = DF3)

summary(lm_I.Cred_Full_1)
length(na.omit(DF3$Credibility_Leaked[DF3$ICA==1]))
length(na.omit(DF3$Credibility_Leaked[DF3$ICA==0]))
```


```{r}
##### Intl_Perception

I.Intl_Full_1 <- Intl_Perception ~ 0 + as.factor(ICA) 


lm_I.Intl_Full_1 <- lm(I.Intl_Full_1, 
                     data = DF3)

summary(lm_I.Intl_Full_1)
length(na.omit(DF3$Intl_Perception[DF3$ICA==1]))
length(na.omit(DF3$Intl_Perception[DF3$ICA==0]))
```


```{r}
##### Authenticity

I.Auth_Full_1 <- Authenticity ~ 0 + as.factor(ICA) 


lm_I.Auth_Full_1 <- lm(I.Auth_Full_1, 
                     data = DF3)

summary(lm_I.Auth_Full_1)
length(na.omit(DF3$Authenticity[DF3$ICA==1]))
length(na.omit(DF3$Authenticity[DF3$ICA==0]))
```

```{r}
##### Crisis_Realism_Leak

I.Realism_Full_1 <- Crisis_Realism_Leak ~ 0 + as.factor(ICA) 


lm_I.Realism_Full_1 <- lm(I.Realism_Full_1, 
                     data = DF3)

summary(lm_I.Realism_Full_1)
length(na.omit(DF3$Crisis_Realism_Leak[DF3$ICA==1]))
length(na.omit(DF3$Crisis_Realism_Leak[DF3$ICA==0]))
```



### Timing and AC 


```{r}
##### ICA_Timer

I.Timer_Full_1 <- ICA_Timer ~ 0 + as.factor(ICA) 


lm_I.Timer_Full_1 <- lm(I.Timer_Full_1, 
                     data = DF3)

summary(lm_I.Timer_Full_1)
length(na.omit(DF3$ICA_Timer[DF3$ICA==1]))
length(na.omit(DF3$ICA_Timer[DF3$ICA==0]))
```


```{r}
##### Used_Check_Binary

I.Used_Full_1 <- Used_Check_Binary ~ 0 + as.factor(ICA) 


lm_I.Used_Full_1 <- lm(I.Used_Full_1, 
                     data = DF3)

summary(lm_I.Used_Full_1)
length(na.omit(DF3$Used_Check_Binary[DF3$ICA==1]))
length(na.omit(DF3$Used_Check_Binary[DF3$ICA==0]))
```

```{r}
##### Supplied_Check_Binary

I.Supplied_Full_1 <- Supplied_Check_Binary ~ 0 + as.factor(ICA) 


lm_I.Supplied_Full_1 <- lm(I.Supplied_Full_1, 
                     data = DF3)

summary(lm_I.Supplied_Full_1)
length(na.omit(DF3$Supplied_Check_Binary[DF3$ICA==1]))
length(na.omit(DF3$Supplied_Check_Binary[DF3$ICA==0]))
```


```{r}
##### Intel_Check_Binary

I.Intel_Full_1 <- Intel_Check_Binary ~ 0 + as.factor(ICA) 


lm_I.Intel_Full_1 <- lm(I.Intel_Full_1, 
                     data = DF3)

summary(lm_I.Intel_Full_1)
length(na.omit(DF3$Intel_Check_Binary[DF3$ICA==1]))
length(na.omit(DF3$Intel_Check_Binary[DF3$ICA==0]))
```



# Graphs 

## Twitter 

### Substantive Questions 

```{r}

#put all the names, estimates, SEs, and behavior into one df for graphing 
Results_DF <- as.data.frame(matrix(data = c("Threat Credibility", coeftest(T.Cred_1)[2, 1:2],"no", 
                                   "Threat Credibility", coeftest(T.Cred_5)[2, 1:2], "yes",
                                   "Support for President", coeftest(T.Potus_1)[2, 1:2],"no", 
                                   "Support for President", coeftest(T.Potus_5)[2, 1:2], "yes",
                                   "Iran Threat Belief", coeftest(T.Iran_1)[2, 1:2], "no",
                                   "Iran Threat Belief", coeftest(T.Iran_5)[2, 1:2], "yes",
                                   "Crisis Realism", coeftest(T.Realism_1)[2, 1:2], "no",
                                   "Crisis Realism", coeftest(T.Realism_5)[2, 1:2], "yes"), 
                                   ncol = 4, byrow = TRUE))

colnames(Results_DF) <- c("dv", "estimate", "se", "controls")

#making into correct operators 
Results_DF$dv <- factor(Results_DF$dv, levels = c("Threat Credibility", "Support for President", "Iran Threat Belief", "Crisis Realism"))
Results_DF$estimate <- as.numeric(Results_DF$estimate)
Results_DF$se <- as.numeric(Results_DF$se)

#adding in CIs 
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
Results_DF$ci <- Results_DF$se*q


## graph time 
pd <- position_dodge(0.5)

ggplot(Results_DF, aes(x = dv, y = estimate, color = controls))  + 
  geom_point(aes(color=controls, shape=controls), position = pd) +
  geom_errorbar(aes(ymin = estimate - ci, ymax = estimate + ci), width = .2, position = pd) +
  theme_minimal() + xlab("Question") + ylab("ATE") + 
  geom_hline(yintercept = 0, linetype="dotted") +
  theme(axis.text.x = element_text(hjust = 1), text = element_text(size = 14)) + coord_flip()

#   ggtitle("ATE of Tweet Treatment on Substantive DVs") #removed for paper 

```


### Timer and AC



```{r}

#put all the names, estimates, SEs, and behavior into one df for graphing 
Results_DF <- as.data.frame(matrix(data = c(
                                   "Target Check", coeftest(T.Target_1)[2, 1:2],"no", 
                                   "Target Check", coeftest(T.Target_5)[2, 1:2], "yes",
                                   "Support Check", coeftest(T.Support_1)[2, 1:2], "no",
                                   "Support Check", coeftest(T.Support_5)[2, 1:2], "yes",
                                   "Sea Check", coeftest(T.Sea_1)[2, 1:2], "no",
                                   "Sea Check", coeftest(T.Sea_5)[2, 1:2], "yes"), 
                                   ncol = 4, byrow = TRUE))

colnames(Results_DF) <- c("dv", "estimate", "se", "controls")

#making into correct operators 
Results_DF$dv <- factor(Results_DF$dv, levels = c("Target Check", "Support Check", "Sea Check"))
Results_DF$estimate <- as.numeric(Results_DF$estimate)
Results_DF$se <- as.numeric(Results_DF$se)

#adding in CIs 
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
Results_DF$ci <- Results_DF$se*q


## graph time 
pd <- position_dodge(0.5)

ggplot(Results_DF, aes(x = dv, y = estimate, color = controls))  + 
  geom_point(aes(color=controls, shape=controls), position = pd) +
  geom_errorbar(aes(ymin = estimate - ci, ymax = estimate + ci), width = .2, position = pd) +
  theme_minimal() + xlab("Question") + ylab("ATE") + 
  geom_hline(yintercept = 0, linetype="dotted") +
  theme(axis.text.x = element_text(hjust = 1), text = element_text(size = 14)) + coord_flip()

#   ggtitle("ATE of Tweet Treatment on Attention Checks") #removed for paper 

```


## Leaked ICA 


### Substantive Questions 


```{r}

#put all the names, estimates, SEs, and behavior into one df for graphing 
Results_DF <- as.data.frame(matrix(data = c("Credibility", coeftest(I.Cred_1)[2, 1:2],"no", 
                                   "Credibility", coeftest(I.Cred_5)[2, 1:2], "yes",
                                   "Intl Perception", coeftest(I.Intl_1)[2, 1:2],"no", 
                                   "Intl Perception", coeftest(I.Intl_5)[2, 1:2], "yes",
                                   "Authenticity", coeftest(I.Auth_1)[2, 1:2], "no",
                                   "Authenticity", coeftest(I.Auth_5)[2, 1:2], "yes",
                                   "Crisis Realism", coeftest(I.Realism_1)[2, 1:2], "no",
                                   "Crisis Realism", coeftest(I.Realism_5)[2, 1:2], "yes"), 
                                   ncol = 4, byrow = TRUE))

colnames(Results_DF) <- c("dv", "estimate", "se", "controls")

#making into correct operators 
Results_DF$dv <- factor(Results_DF$dv, levels = c("Credibility", "Intl Perception", "Authenticity", "Crisis Realism"))
Results_DF$estimate <- as.numeric(Results_DF$estimate)
Results_DF$se <- as.numeric(Results_DF$se)

#adding in CIs 
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
Results_DF$ci <- Results_DF$se*q


## graph time 
pd <- position_dodge(0.5)

ggplot(Results_DF, aes(x = dv, y = estimate, color = controls))  + 
  geom_point(aes(color=controls, shape=controls), position = pd) +
  geom_errorbar(aes(ymin = estimate - ci, ymax = estimate + ci), width = .2, position = pd) +
  theme_minimal() + xlab("Question") + ylab("ATE") + 
  geom_hline(yintercept = 0, linetype="dotted") +
  theme(axis.text.x = element_text(hjust = 1), text = element_text(size = 14)) + coord_flip()

#   ggtitle("ATE of ICA Treatment on Substantive DVs") #removed for paper 

```

### Timer and AC


```{r}

#put all the names, estimates, SEs, and behavior into one df for graphing 
Results_DF <- as.data.frame(matrix(data = c(
                                   "Used Check", coeftest(I.Used_1)[2, 1:2],"no", 
                                   "Used Check", coeftest(I.Used_5)[2, 1:2], "yes",
                                   "Supplied Check", coeftest(I.Supplied_1)[2, 1:2], "no",
                                   "Supplied Check", coeftest(I.Supplied_5)[2, 1:2], "yes",
                                   "Intel Check", coeftest(I.Intel_1)[2, 1:2], "no",
                                   "Intel Check", coeftest(I.Intel_5)[2, 1:2], "yes"), 
                                   ncol = 4, byrow = TRUE))

colnames(Results_DF) <- c("dv", "estimate", "se", "controls")

#making into correct operators 
Results_DF$dv <- factor(Results_DF$dv, levels = c("Used Check", "Supplied Check", "Intel Check"))
Results_DF$estimate <- as.numeric(Results_DF$estimate)
Results_DF$se <- as.numeric(Results_DF$se)

#adding in CIs 
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
Results_DF$ci <- Results_DF$se*q


## graph time 
pd <- position_dodge(0.5)

ggplot(Results_DF, aes(x = dv, y = estimate, color = controls))  + 
  geom_point(aes(color=controls, shape=controls), position = pd) +
  geom_errorbar(aes(ymin = estimate - ci, ymax = estimate + ci), width = .2, position = pd) +
  theme_minimal() + xlab("Question") + ylab("ATE") + 
  geom_hline(yintercept = 0, linetype="dotted") +
  theme(axis.text.x = element_text(hjust = 1), text = element_text(size = 14)) + coord_flip()

#   ggtitle("ATE of ICA Treatment on Attention Checks") #removed for paper 

```
# Equivalence Testing 

## Tweet 

```{r}

#############Credibility_Tweet################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_Tweet <- mean(as.numeric(DF3$Credibility_Tweet[DF3$Tweet==1]))
Avg_PlainText <- mean(as.numeric(DF3$Credibility_Tweet[DF3$Tweet==0]))
SD_Tweet <- sd(as.numeric(DF3$Credibility_Tweet[DF3$Tweet==1]))
SD_PlainText <- sd(as.numeric(DF3$Credibility_Tweet[DF3$Tweet==0]))
N_Tweet <- length(DF3$Credibility_Tweet[DF3$Tweet==1])
N_PlainText <- length(DF3$Credibility_Tweet[DF3$Tweet==0])
LowerBound <- 5/20 #1/20 of scale 
HigherBound <- 5/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_Tweet, m2=Avg_PlainText, 
        sd1=SD_Tweet, sd2=SD_PlainText, 
        n1=N_Tweet, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```

```{r}

#############POTUS_Support################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_Tweet <- mean(as.numeric(DF3$POTUS_Support[DF3$Tweet==1]))
Avg_PlainText <- mean(as.numeric(DF3$POTUS_Support[DF3$Tweet==0]))
SD_Tweet <- sd(as.numeric(DF3$POTUS_Support[DF3$Tweet==1]))
SD_PlainText <- sd(as.numeric(DF3$POTUS_Support[DF3$Tweet==0]))
N_Tweet <- length(DF3$POTUS_Support[DF3$Tweet==1])
N_PlainText <- length(DF3$POTUS_Support[DF3$Tweet==0])
LowerBound <- 5/20 #1/20 of scale 
HigherBound <- 5/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_Tweet, m2=Avg_PlainText, 
        sd1=SD_Tweet, sd2=SD_PlainText, 
        n1=N_Tweet, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```
```{r}

#############Iran_Perception################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_Tweet <- mean(as.numeric(DF3$Iran_Perception[DF3$Tweet==1]))
Avg_PlainText <- mean(as.numeric(DF3$Iran_Perception[DF3$Tweet==0]))
SD_Tweet <- sd(as.numeric(DF3$Iran_Perception[DF3$Tweet==1]))
SD_PlainText <- sd(as.numeric(DF3$Iran_Perception[DF3$Tweet==0]))
N_Tweet <- length(DF3$Iran_Perception[DF3$Tweet==1])
N_PlainText <- length(DF3$Iran_Perception[DF3$Tweet==0])
LowerBound <- 5/20 #1/20 of scale 
HigherBound <- 5/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_Tweet, m2=Avg_PlainText, 
        sd1=SD_Tweet, sd2=SD_PlainText, 
        n1=N_Tweet, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```

```{r}

#############Crisis_Realism_Tweet################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_Tweet <- mean(as.numeric(DF3$Crisis_Realism_Tweet[DF3$Tweet==1]))
Avg_PlainText <- mean(as.numeric(DF3$Crisis_Realism_Tweet[DF3$Tweet==0]))
SD_Tweet <- sd(as.numeric(DF3$Crisis_Realism_Tweet[DF3$Tweet==1]))
SD_PlainText <- sd(as.numeric(DF3$Crisis_Realism_Tweet[DF3$Tweet==0]))
N_Tweet <- length(DF3$Crisis_Realism_Tweet[DF3$Tweet==1])
N_PlainText <- length(DF3$Crisis_Realism_Tweet[DF3$Tweet==0])
LowerBound <- 5/20 #1/20 of scale 
HigherBound <- 5/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_Tweet, m2=Avg_PlainText, 
        sd1=SD_Tweet, sd2=SD_PlainText, 
        n1=N_Tweet, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```

## ICA 

```{r}

#############Credibility_Leaked################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_ICA <- mean(as.numeric(DF3$Credibility_Leaked[DF3$ICA==1]))
Avg_PlainText <- mean(as.numeric(DF3$Credibility_Leaked[DF3$ICA==0]))
SD_ICA <- sd(as.numeric(DF3$Credibility_Leaked[DF3$ICA==1]))
SD_PlainText <- sd(as.numeric(DF3$Credibility_Leaked[DF3$ICA==0]))
N_ICA <- length(DF3$Credibility_Leaked[DF3$ICA==1])
N_PlainText <- length(DF3$Credibility_Leaked[DF3$ICA==0])
LowerBound <- 5/20 #1/20 of scale 
HigherBound <- 5/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_ICA, m2=Avg_PlainText, 
        sd1=SD_ICA, sd2=SD_PlainText, 
        n1=N_ICA, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```


```{r}

#############Intl_Perception################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_ICA <- mean(as.numeric(DF3$Intl_Perception[DF3$ICA==1]))
Avg_PlainText <- mean(as.numeric(DF3$Intl_Perception[DF3$ICA==0]))
SD_ICA <- sd(as.numeric(DF3$Intl_Perception[DF3$ICA==1]))
SD_PlainText <- sd(as.numeric(DF3$Intl_Perception[DF3$ICA==0]))
N_ICA <- length(DF3$Intl_Perception[DF3$ICA==1])
N_PlainText <- length(DF3$Intl_Perception[DF3$ICA==0])
LowerBound <- 5/20 #1/20 of scale 
HigherBound <- 5/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_ICA, m2=Avg_PlainText, 
        sd1=SD_ICA, sd2=SD_PlainText, 
        n1=N_ICA, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```
```{r}

#############Authenticity################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_ICA <- mean(as.numeric(DF3$Authenticity[DF3$ICA==1]))
Avg_PlainText <- mean(as.numeric(DF3$Authenticity[DF3$ICA==0]))
SD_ICA <- sd(as.numeric(DF3$Authenticity[DF3$ICA==1]))
SD_PlainText <- sd(as.numeric(DF3$Authenticity[DF3$ICA==0]))
N_ICA <- length(DF3$Authenticity[DF3$ICA==1])
N_PlainText <- length(DF3$Authenticity[DF3$ICA==0])
LowerBound <- 5/20 #1/20 of scale 
HigherBound <- 5/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_ICA, m2=Avg_PlainText, 
        sd1=SD_ICA, sd2=SD_PlainText, 
        n1=N_ICA, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```

```{r}

#############Crisis_Realism_Leak################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_ICA <- mean(as.numeric(DF3$Crisis_Realism_Leak[DF3$ICA==1]))
Avg_PlainText <- mean(as.numeric(DF3$Crisis_Realism_Leak[DF3$ICA==0]))
SD_ICA <- sd(as.numeric(DF3$Crisis_Realism_Leak[DF3$ICA==1]))
SD_PlainText <- sd(as.numeric(DF3$Crisis_Realism_Leak[DF3$ICA==0]))
N_ICA <- length(DF3$Crisis_Realism_Leak[DF3$ICA==1])
N_PlainText <- length(DF3$Crisis_Realism_Leak[DF3$ICA==0])
LowerBound <- 5/20 #1/20 of scale 
HigherBound <- 5/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_ICA, m2=Avg_PlainText, 
        sd1=SD_ICA, sd2=SD_PlainText, 
        n1=N_ICA, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```

